<template>
	<shopPage :showArrow="showArrow"></shopPage>
</template>

<script>
var app = getApp();
var _this;
import shopPage from "../../../appComponent/shopPage/shopPage";
import common from '../../../utils/common.js';

export default {
  data() {
    return {
	  showArrow: true,
	  pageOpenTimes: 0,
    };
  },

  // 分享
  onShareAppMessage() {
    if (_this.config.config.shop_wxapp_share_title != '' && _this.config.config.shop_wxapp_share_img != '') {
      return {
        title: _this.config.config.shop_wxapp_share_title,
        imageUrl: _this.config.config.shop_wxapp_share_img,
        path: '/pages/nofooter/shop/shop_index'
      };
    } else {
      return false;
    }
  },

  // 生命周期函数--监听页面加载
  onLoad: function (options) {
    _this = this;
    app.globalData.isPay = false; // 是否是识别二维码打开

    if (options.scene) {
      var scene = decodeURIComponent(options.scene);
      console.log("scene is ", scene);
      wx.navigateTo({
        url: '/pages/shop_new/shopDetail/shopDetail?' + scene
      });
    } // 是否是店铺详情页分享打开


    if (options.store_id && options.backgroundColor && options.frontColor) {
      wx.navigateTo({
        url: `/pages/shop_new/shopDetail/shopDetail?store_id=${options.store_id}&backgroundColor=${options.backgroundColor}&frontColor=${options.frontColor}`
      });
    }
  },
  onShow: function () {
    // 页面被展示
  	common.editTabbar();
    _this.pageOpenTimes++;
  	
  	uni.$emit('pageShow', _this.pageOpenTimes)
	
	// #ifdef H5
	setWxShare();
	// #endif
  },
  onUnload () {
  	  uni.$off('pageShow')
  },
  components: {
    shopPage
  },
  methods: {
  }
};
// 微信h5分享
	const setWxShare = () => {
		common.getConfig(function(data){
			let pageLink = `${common.requestDomain}packapp/${common.wxapp_type}/pages/nofooter/shop/shop_index`;
			let shareWxLink = common.addShareParam(pageLink);
			var shareData = {
				title: data.config.shop_wxapp_share_title,
				desc: common.changeTxt('点击立马查看更多店铺与优惠'),
				sendFriendLink: shareWxLink,
				share_img: data.config.shop_wxapp_share_img
			};
			common.setWxShare(shareData);
		})
		
	};
</script>
<style>
/* pages/nofooter/shop/shop_index.css */
</style>